<link rel="stylesheet" type="text/css" href="/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="/easyui/themes/icon.css">
<link rel="stylesheet" type="text/css" href="/easyui/demo.css">
<link rel="stylesheet" type="text/css" href="/easyui/base.css">
<link rel="stylesheet" type="text/css" href="/lib/Hui-iconfont/1.0.8/iconfont.css" />
<script type="text/javascript" src="/easyui/jquery.min.js"></script>
<script type="text/javascript" src="/easyui/jquery.easyui.min.js"></script>
<body class="easyui-layout">
<!-- 说明 字符串：CustomerInfo，作为替换字符串 -->
<!-- 遮罩层 -->
<div id='PageLoadingTip' style="position: absolute; z-index: 1000; top: 0px; left: 0px; width: 100%; height: 100%; background: #c7edcc; text-align: center;">
    <h1 style="top: 48%; position: relative;color:#15428B;">页面加载中···</h1>
</div>

<div class="easyui-layout" style="width:100%;height:100%;padding-bottom:" id="conent-layout">
    <div data-options="region:'center',border:false" style="height: auto">
        <div class="easyui-layout" style="width:100%;height:100%;">
            <!-- 主表  -->
            <table id="customerInfo_table" class="easyui-datagrid" title="" style="width:100%;height:100%;padding-bottom: 2px;"
                   data-options="rownumbers:true, pagination:true,singleSelect:true,url:'/customerInfo-list/1/20',
                              method:'get',
                              toolbar:'#tb',
                              loadMsg : '数据加载中',
                              fitColumns : true,
                              showFooter: true" >
                <thead>
                    <tr>
                        <th data-options="field:'customerMail', width:90" >登录邮箱</th>
                        <th data-options="field:'customerName', width:90" >名称</th>
                        <th data-options="field:'isBlackList', width:90,formatter:formatBlack" >是否黑名单</th>
                    </tr>
                </thead>
            </table>
        </div>
    </div>
</div>

<!-- 搜索框 -->
<div id="tb" style="padding:5px;height:auto">

    <div style="margin:5px 0;"></div>
    <div>
        <#list buttons as buttons>
            <a href="#" class="easyui-linkbutton" iconCls="${buttons.iconCls}" id="${buttons.buttonId}">${buttons.buttonName}</a>
        </#list>
    </div>
</div>
<script type="text/javascript" src="/lib/layer/2.4/layer.js"></script>

<!-- 按钮操作 -->
<script type="text/javascript">
    //审核
    $("#add").click(function () {
        var row = $('#customerInfo_table').datagrid('getSelected');
        if(!row){
            layer.msg('请选择需要拉黑的用户');
        }else{
            $.messager.confirm('拉黑用户','确定要切换用户名为:'+row.customerName+"的用户状态吗",function(r){
                if (r){
                    var time = new Date();
                    $.ajax({
                        url :'/customer-black-list',
                        data : {id :row.id},
                        async : true,
                        success : function(result){
                            $('#customerInfo_table').datagrid('reload');

                        }
                    });
                }
            });
        }
    })

</script>

<script type="text/javascript">
    function formatBlack(val ,row) {
        if(val=='Y'){
            return '黑名单'
        }else if(val == 'N'){
            return '白名单'
        }
    }
</script>

<!-- 分页 -->
<script type="text/javascript">
	$(function(){
		var p = $('#customerInfo_table').datagrid().datagrid('getPager');
		p.pagination({
			pageSize: 20, //每页显示的记录条数，默认为10
			pageList: [20, 40, 60], //可以设置每页记录条数的列表
			onSelectPage: function (pageNumber, pageSize) {
			    if(pageNumber==0){
			        pageNumber = 1;
                }
				var handler = '/customerInfo-list/'+pageNumber+"/"+pageSize;
				$('#customerInfo_table').datagrid('options').url = handler;
				$('#customerInfo_table').datagrid('reload');
			}
		});
	})
</script>

<script type="text/javascript">
    $(document).ready(function(){
        $('#conent-layout').layout('collapse','east');
    });
</script>

<!-- 遮罩层 -->
<script type="text/javascript">
    function _PageLoadingTip_Closes() {
        $("#PageLoadingTip").fadeOut("normal", function () {
            $(this).remove();
        });
    }
    var _pageloding_pc;
    $.parser.onComplete = function () {
        if (_pageloding_pc) clearTimeout(_pageloding_pc);
        _pageloding_pc = setTimeout(_PageLoadingTip_Closes, 1000);
    }
</script>